<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:common="http://java.sun.com/jsf/composite/common">
<h:body>
	<ui:composition template="/pages/templates/MainTemplate.xhtml">
		<ui:define name="content">
			<div>
				<h3>Articulos</h3>
			</div>
			<h:form id="addItemForm" styleClass="tableNoGrid">
				<p:messages id="addMessages" showDetail="true" globalOnly="true"></p:messages>
				<p:panelGrid columns="1" style="width: 100%; table-layout: fixed;">
					<p:row>
						<p:column>
							<common:CRUDMenuBar id="itemsMenuBar" crudManagedBean="#{itemsMB}">
							</common:CRUDMenuBar>
						</p:column>
					</p:row>
					<p:row>
						<p:column>
							<common:items selectButtonRendered="false" id="items" />
						</p:column>
					</p:row>
				</p:panelGrid>

				<h:panelGroup layout="block" id="abm_id">
					<h:panelGroup rendered="#{itemsMB.showAbm}">
						<ui:include src="administracion/articulosAbm.xhtml"></ui:include>
						<p:panelGrid id="buttonsContainer" columns="1">
							<p:row>
								<p:column>
									<p:commandButton id="addItemButton" rendered="#{!itemsMB.editing}"
										actionListener="#{itemsMB.addItem}" value="Agregar" icon="ui-icon-arrowthick-1-n"
										update=":addItemForm:addMessages :addItemForm:abm_id :addItemForm:itemsData:itemsPanel :addItemForm:items:items"
										style="margin-top: 10px;" />
									<p:commandButton id="saveItemButton" rendered="#{itemsMB.editing}"
										actionListener="#{itemsMB.saveItem}" value="Guardar" icon="ui-icon-disk"
										update=":addItemForm:addMessages :addItemForm:itemsData:itemsPanel :addItemForm:abm_id :addItemForm:items:items"
										style="margin-top: 10px;" />
									<p:commandButton id="cancelItemButton" actionListener="#{itemsMB.resetItem}"
										value="Cancelar" icon="ui-icon-cancel"
										update=":addItemForm:addMessages :addItemForm:itemsData:itemsPanel :addItemForm:abm_id  :addItemForm:items:items"
										style="margin-top: 10px;" process="@this" />
								</p:column>
							</p:row>
						</p:panelGrid>
					</h:panelGroup>
				</h:panelGroup>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>